package t2;

import java.util.Scanner;

/**
 * @author 兴趣使然黄小黄
 * @version 1.0
 */
@SuppressWarnings({"all"})
public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while(in.hasNextLine()){
            String input = in.nextLine();
            String ret = eraseString(input);
            if (ret == null || ret.length() == 0){
                System.out.println("0");
            }else {
                System.out.println(ret);
            }
        }
        in.close();
    }

    // 用于处理字符串
    public static String eraseString(String input) {
        StringBuilder ret = new StringBuilder(); // 用于接收input
        int index = -1; // 指向前一个位置
        for (char c : input.toCharArray()) {
            if (index >= 0 && c == ret.charAt(index)){
                ret.deleteCharAt(index);
                index--;
            }else {
                ret.append(c); // 拼接
                index++;
            }
        }
        return ret.toString();
    }
}
